package com.junzhiit.nengji.shop.model.enums;

import com.bainaeco.framework.exception.InvalidArgumentException;

public enum PostageType {
	
	POSTAGE(0,"包邮"),
	UNIFY(1,"统一运费"),
	TEMPLATE(2,"运费模板");
	private Integer value;
	private String text;

	private PostageType(Integer value,String text) {
		this.value = value;
		this.text = text;
	}

	public int toIntValue() {
		return this.value;
	}
	
	public String toStringText() {
		return this.text;
	}

	public static PostageType toType(Integer value) {
		if (POSTAGE.value == value) {
			return POSTAGE;
		} else if (UNIFY.value == value) {
			return UNIFY;
		} else if (TEMPLATE.value == value) {
			return TEMPLATE;
		}else {
			throw new InvalidArgumentException("Unknown PostageType[" + value + "].");
		}
	}
}
